class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        vector<int> ret;
        unordered_map<int, int> hash;
        for (int i = 0; i < nums.size(); i++)
        {
            int key = target - nums[i];
            if (hash.count(key))
                return { hash[key], i };
            else
                hash[nums[i]] = i;
        }
        return ret;
    }
};